package cn.ecut.dispatcher;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/xushu")
public class XushuServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("找到徐庶了，但是徐庶说：你去找诸葛亮");
//        response.sendRedirect("/zhugeliang");  //重定向
        //本质 ： 响应 发送了 302 的状态码
        response.setStatus( HttpServletResponse.SC_FOUND );
        response.setHeader("location" , "/zhugeliang");

        //找到徐庶了，但是徐庶说：你去找诸葛亮
    }
}
